﻿using System.Collections.Generic;
using System.Linq.Expressions;
using System.Reflection;
using CoreEx.Database.Query;

namespace CoreEx.Database.Linq
{
    /// <summary>
    /// Represents a class that is capable of translating an 
    /// <see cref="Expression"/> into an <see cref="ITranslateResult"/>
    /// </summary>
    public interface IExpressionTranslator
    {
        /// <summary>
        /// Translates the <paramref name="expression"/> into an <see cref="ITranslateResult"/> instance.
        /// </summary>
        /// <param name="expression">The <see cref="Expression"/> to translate.</param>
        /// <returns>An <see cref="ITranslateResult"/> instances that represents the translated <see cref="Expression"/>.</returns>
        ITranslateResult Translate(Expression expression);
 
        ITranslateResult Translate(Expression expression, ITranslateResult parent, bool createSubQuery);

        ITranslateResult Translate(IRelationLoadTarget relationLoadTarget, IProjectionTarget outerProjectionTarget, ITranslateResult outerTranslateResult);

        ITranslateResult Translate(Expression expression, PropertyInfo property, IProjectionTarget outerProjectionTarget);

    }
}